import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '@/views/HomeView.vue';
import UserView from '@/views/UserView.vue';
import StaffView from '@/views/StaffView.vue';
import LoginView from '@/views/LoginView.vue';

const routes = [
  {
    path: '/',
    name: 'root',
    redirect: '/login'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    redirect: { path: '/home/user' },
    children: [
      { path: 'user', component: () => import('@/views/home/UserView.vue') },
      { path: 'babyMom', component: () => import('@/views/home/BabyMomView.vue') },
      { path: 'condition', component: () => import('@/views/home/ConditionView.vue') },
      { path: 'employee', component: () => import('@/views/home/EmployeeView.vue') },
      { path: 'orderFrom', component: () => import('@/views/home/OrderFromView.vue') },
      { path: 'subscribe', component: () => import('@/views/home/SubscribeView.vue') }
    ]
  },
  {
    path: '/staff',
    name: 'staff',
    component: StaffView,
    redirect: { path: '/staff/message' },
    children: [
      { path: 'message', component: () => import('@/views/staff/MessageView.vue') }
    ]
  },
  {
    path: '/user',
    name: 'user',
    component: UserView,
    redirect: { path: '/user/service' },
    children: [
      { path: 'service', component: () => import('@/views/user/ServiceView.vue') },
      { path: 'userDetails', component: () => import('@/views/user/UserDetailsView.vue') }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView
  }
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});

export default router;
